var background = {
  spiderType: "",
  init() {
    this.onMessage();
  },
  onMessage() {
    // 监听来自content-script的消息
    chrome.runtime.onMessage.addListener(( request, sender, sendResponse ) => {
      if(request.cmd == 'getSpiderType'){
          sendResponse(this.spiderType)
      }else if(request.cmd == 'setSpiderType' && request.spiderType){
          this.spiderType = request.spiderType
      }
    });
  }
};
